//pages/zstz/selfPkResult/selfPkResult.js
const app = getApp().globalData;

Page({

  /**
   * 页面的初始数据
   */
  data: {
    userInfo: null,
    score: '856',
    typeId: '',
    typeName: '',
    showredpacket: false, //红包封面弹窗
    showyhqpop: false, //红包金额弹窗
    shownoRedpop: false,
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    this.setData({
      userInfo: wx.getStorageSync('userInfo'),
      typeId: options.typeId,
      typeName: options.typeName,
      score: options.sumScore
    })
    wx.setNavigationBarTitle({ //动态修改标题
      title: '知识竞答结果'
    });
  },

  //返回首页
  bindBackFirst: function (event) {
    console.log('返回首页')
    wx.reLaunch({
      url: '/pages/zstz/zstzIndex/index'
    })
  },

  // 点击领红包
  showyhqpop() {
    this.setData({
      showredpacket: false,
      showyhqpop: true,
    })
  },

  // 关闭红包弹窗
  closeyredpop() {
    this.setData({
      showredpacket: false
    })
  },

  // 关闭红包金额弹窗
  closeyhqpop() {
    this.setData({
      showyhqpop: false
    })
  },

  // 关闭红包领完弹窗
  closenoRedpop() {
    this.setData({
      shownoRedpop: false
    })
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {
    let that = this;
    return {
      title: '知识竞答结果',
      path: '/pages/zstz/selfPkResult/selfPkResult?typeId=' + that.data.typeId + '&typeName=' + that.data.typeName + '&sumScore=' + that.data.score
    }
  },

  onShareTimeline: function (res) {
    let that = this;
    return {
      title: '线上竞答结果',
      query: 'typeId=' + that.data.typeId + '&typeName=' + that.data.typeName + '&sumScore=' + that.data.score
    }
  },

})